import i18n from '@/i18n'
import { IsArray, IsEnum, IsNotEmpty, IsNumber, MaxLength } from 'class-validator'
import { DomainModel } from '@apps/meta/domain/model'
import { ApiProperty } from '@nestjs/swagger'
import { MetaResourceModelBatchSaveItemDto } from '../../meta-resource-model/dto/meta-resource-model-batch-save.dto'

export class MetaResourceModuleActionSaveDto {
  @ApiProperty({ description: i18n.t('dto.meta-resource-module-action-save.583486-0'), type: Number })
  @IsNotEmpty()
  @IsNumber()
  resourceModuleId: number

  @ApiProperty({ description: i18n.t('dto.meta-resource-module-action-save.583486-1'), type: String })
  @IsNotEmpty()
  @MaxLength(64)
  name: string

  @ApiProperty({ description: i18n.t('dto.meta-resource-module-action-save.583486-2'), type: String })
  @IsNotEmpty()
  @MaxLength(64)
  label: string

  @ApiProperty({ description: i18n.t('dto.meta-resource-module-action-save.583486-3'), type: String })
  @IsNotEmpty()
  @MaxLength(64)
  platform: string

  @ApiProperty({ description: i18n.t('dto.meta-resource-module-action-save.583486-4'), type: String })
  @MaxLength(64)
  project?: string

  @ApiProperty({
    description: i18n.t('dto.meta-resource-module-action-save.583486-5'),
    enum: DomainModel.ApiPropertyEnum.MetaResourceModuleActionType,
  })
  @IsNotEmpty()
  @IsEnum(DomainModel.MetaResourceModuleActionType)
  actionType: DomainModel.MetaResourceModuleActionType

  @ApiProperty({ description: i18n.t('dto.meta-resource-module-action-save.583486-6') })
  @IsArray()
  requestModels?: MetaResourceModelBatchSaveItemDto[]

  @ApiProperty({ description: i18n.t('dto.meta-resource-module-action-save.583486-7') })
  @IsArray()
  responseModels?: MetaResourceModelBatchSaveItemDto[]
}
